package com.ruoyi;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

import java.net.ServerSocket;
import java.net.Socket;

/**
 * 启动程序
 * 
 * @author ruoyi
 */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication
{
    public static void main(String[] args)
    {
        System.setProperty("spring.devtools.restart.enabled", "false");
//        SpringApplication.run(RuoYiApplication.class, args);
//        System.out.println("启动成功");
        try {
            ServerSocket serverSocket = new ServerSocket(9100);//持续监听接口
            System.out.println("启动服务器....端口为:" + 9100 + " wait connect...");
            Socket socket = null;

            while (true) {
                socket = serverSocket.accept();//建立socket连接
                System.out.println("收到客户端连接，客户端:" + socket.getInetAddress().getHostAddress() + "已连接到服务器");
                ServerThread serverThread = new ServerThread(socket);
                serverThread.start();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
